/*
 * TagList.h
 *
 *  Created on: 19 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#ifndef TAGLIST_H_
#define TAGLIST_H_

#include "NamedTag.h"
#include <vector>
#include <limits>

namespace NamedBinaryTag
{

class __attribute__((visibility("default"))) TagList: public NamedBinaryTag::NamedTag
{
private:
	TagTypes listType;
	std::vector<ITag*> items;
public:
	TagList();
	virtual ~TagList();

	TagTypes get_TagType() const;

	void Read(std::istream &input, bool ignoreName);
	void Write(std::ostream &output, bool ignoreName) const;

	TagTypes get_ListType() const;
	void set_ListType(TagTypes type);
	bool Add(ITag *tag);
	bool Insert(ITag *tag, size_t index) throw();
	bool Remove(ITag *tag);
	void Clear();
	bool Remove(size_t index) throw();
	ITag *operator[](size_t index) const throw();
	size_t get_Count() const;
	ITag *get_Item(size_t index) const throw();
	void set_Item(size_t index, ITag *tag) throw();

	ITag *clone() const;
protected:
	TagList(void *root) : NamedTag(root) {}
	ITag *clone(void *newRoot) const;
};

}

#endif /* TAGLIST_H_ */
